@echo off
setlocal enabledelayedexpansion

set "output_file=final-merge.sql"
set "folder_path=./src/db"

rem 检测合并后的文件是否存在，如果存在则先删除文件
if exist "%output_file%" (
  echo Deleting existing file: %output_file%
  del "%output_file%"
)

rem Combine all .sql files into a single file
for %%f in ("%folder_path%\*.sql") do (
  type "%%f" >> "%output_file%"
  echo. >> "%output_file%"
)

echo "All .sql files have been merged into %output_file%."
